namespace ghost
{
    /**角色释放技能时产生的相关数据，用于计算攻击伤害*/
    export class OwnerData{
        /**拥有者id*/public _id:number;
        /**属性*/public _typesAttr: {[type: number]: number};
        /**技能*/public _skillData:ISkillData;
        /**技能配置*/public _skillCfg:SkillCfg;        
        /**拥有者*/public _owner:GameRole;
        /**阵营类型*/public _camp:number;        
        // /**buff-属性叠加*/public _buffTypesAttr: {[type: number]: number};
        // /**子级类型*/public _gameRoleSubType:GameRoleSubType;
        /**当前技能击打目标记录(mmo)*/public skillHitDict:{[id:number]:any};	
        // /**是否剧情创建的*/public createFrom:map2D.CreateFromType;
        /**角色ID*/public _roleID:string;
        // /**buff数值*/public _buffValues:number[];              
        /**索敌目标*/public _targetId:number;
        /**技能增强系数*/public _enhanceValue:number;
        constructor(r:GameRole,skill:ISkillData, enhance:number=0)
        {
            this.skillHitDict = {};
            this.setData(r, skill, enhance);
        }
        public setData(r:GameRole, mmoSkill:ISkillData, enhance:number):void
        {
            let s= this;
            s._id = r._id;
            s._owner = r;
            s._typesAttr = r._typesAttr;            
            s._camp = s._camp;
            s._skillData = mmoSkill;
            s._skillCfg = mmoSkill.skillCfg;            
            // s._buffTypesAttr = r._buffTypesAttr;
            // s._gameRoleSubType = r._gameRoleSubType;
            // s.createFrom = r.createFrom;
            s._roleID = r.roleID;
            s._enhanceValue = enhance;
            s._targetId = r.getAtkTargetIds()[0];
            // s._buffValues = r.buffValues.concat();
        }   
        //获取属性
		public getAttr(type: number): number {
			let val:number,buffVal:number;
            val = Number(this._typesAttr && this._typesAttr[type] && Math.ceil(this._typesAttr[type]));
            if(val!=val)
                val = 0;
            return val;
            // buffVal = Number(this._buffTypesAttr && this._buffTypesAttr[type] && Math.ceil(this._buffTypesAttr[type]));
            // if(buffVal!=buffVal)
            //     buffVal = 0; 
			// return AttrDefineCfg.getRealAttr(type, val + buffVal);
		}  
        public ownerIsValid():boolean
        {
            return this._owner._id == this._id;
        }
        // public isStoryCreate():boolean
        // {
        //     return this.createFrom == map2D.CreateFromType.STORY;
        // }
    }
}